home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.3 / Video Toaster v4.3.iso / 3.1 / toasterall / arexx_examples / tpaint / tpblast.rexx < prev    next >
OS/2 REXX Batch file  |  1993-05-13  |  3KB  |  103 lines

  1. /* TP Animate Blast! */
  2. /* © 1993 NewTek, Inc.    by Arnie Cachelin */
  3.  
  4.  
  5. PARSE ARG x1 y1 x2 y2 frames radius savename startframe loadname
  6.  
  7. if x1="" | x2="" | y2="" | y1="" | frames="" | savename="" then do
  8.   say "Usage: rx TPBlast x1 y1 x2 y2  frames radius savename [startframe [loadname]]"
  9.   exit
  10. end
  11.  
  12. Address "DigiPaint"     /* Tell ARexx where commands go  */
  13. if pos("DigiPaint",show(ports))=0 then do
  14.   say "Can't find ToasterPaint!"
  15.   exit
  16.   end
  17.  
  18. if startframe="" then startframe=0
  19.  
  20. 'Mine'          /* Set Edge transparency to 0% */
  21. 'Midc'          /* Set Center transparency to 50% */
  22. 'Drci'
  23. 'Flon'
  24. rstep=(radius/frames)+1
  25. xstep=((x2-x1)/frames)
  26. ystep=((y2-y1)/frames)
  27. do i=1 to frames
  28.   if loadname ~="" then say 'Call LoadRGB('loadname||right(i+startframe,3,"0")')'
  29.   if loadname ~="" then Call LoadRGB(loadname||right((i+startframe),3,"0"))
  30.   dx=(i*xstep)%1
  31.   dy=(i*ystep)%1
  32.   r=(i*rstep)%1
  33.   x=x1+dx
  34.   y=y1+dy
  35.   'Minc'
  36.   'Mide'
  37.   'Pend' x y
  38.   'Penu' x+r y
  39.   'Midc'
  40.   'Mine'
  41.   'Pend' x y
  42.   'Penu' x+r%2 y
  43.   say x1'+'dx  y1'+'dy x y r
  44.   'Shco'
  45.   'Undo'
  46.   say 'Call SaveRGB('savename||right(i+startframe,3,"0")')'
  47.   Call SaveRGB(savename||right(i+startframe,3,"0"))
  48.   end
  49.  
  50. exit
  51.  
  52. SetFile: PROCEDURE           /* Select file in current requester */
  53.   arg file
  54.   dirname=GetPathName(file)
  55.   'Dnam'dirname          /* Enter file path  */
  56.   'Dsel'                 /* Hit return on directory */
  57.   'Dnam'dirname          /* Enter file path  */
  58.   'Dsel'                 /* Hit return on directory */
  59.   filename=GetFileName(file)
  60.   'Fnam'filename         /* Enter File name  */
  61.   'Okls'                 /* Hit the OK button  */
  62.   return
  63.  
  64. LoadFrameStore: PROCEDURE   /* Load FrameStore */
  65.   arg filename           /* must have ###.fs on front! */
  66.   'Loco'                 /* Call file requester  */
  67.   'Fnam'filename         /* Enter File name  */
  68.   'Okls'                 /* Hit the OK button  */
  69.   return 0
  70.  
  71. SaveFrameStore: PROCEDURE   /* Save FrameStore */
  72.   arg filename           /* must have ###.fs on front! */
  73.   'Saco'                 /* Call file requester  */
  74.   'Fnam'filename         /* Enter File name  */
  75.   'Okls'                 /* Hit the OK button  */
  76.   return 0
  77.  
  78. LoadRGB: PROCEDURE   /* Load IFF RGB, copy into swap buffer */
  79.   arg filename
  80.   'Lo24'                 /* Call file requester  */
  81.     Call SetFile(filename)
  82.   return
  83.  
  84. SaveRGB: PROCEDURE   /* Save IFF RGB, copy into swap buffer */
  85.   arg filename
  86.   'Sa24'                 /* Call file requester  */
  87.     Call SetFile(filename)
  88.   return
  89.  
  90. GetFileName: procedure  /* Extract file name from full file specification */
  91.   ARG fullfile
  92.   c = lastpos("/",fullfile)
  93.   if c = 0 then c = lastpos(":",fullfile)
  94.   return substr(fullfile, c + 1)
  95.  
  96. GetPathName: procedure  /* Extract directory name from full file specification */
  97.   ARG fullfile
  98.   c = lastpos("/",fullfile)
  99.   if c = 0 then c = lastpos(":",fullfile)
  100.   return left(fullfile,c)
  101.  
  102.  
  103.